
*** Set Fixed Effects and Clustering
global fe "courtq"
global clusvar "partyr"

***********************************
**** Cross-Sample Monotonicity ****
***********************************

frame drop monotone
frame create monotone str55 courtsample str55 estsample str55 instsample  beta se N 

foreach g in black female stabilized {

		*Courts Sample
		reghdfe evictionorder z_not`g' if i`g'==1, absorb($fe) cluster($clusvar)
		frame post monotone ("all cases")  ("`g'") ("not`g'") (_b[z_not`g']) (_se[z_not`g']) (e(N))

		reghdfe evictionorder z_`g' if inot`g'==1, absorb($fe) cluster($clusvar)
		frame post monotone ("all cases") ("not`g'") ("`g'") (_b[z_`g']) (_se[z_`g']) (e(N))

		reghdfe evictionorder z_`g' if i`g'==1, absorb($fe) cluster($clusvar)
		frame post monotone ("all cases")  ("`g'") ("`g'") (_b[z_`g']) (_se[z_`g']) (e(N))

		reghdfe evictionorder z_not`g' if inot`g'==1, absorb($fe) cluster($clusvar)
		frame post monotone ("all cases") ("not`g'") ("not`g'") (_b[z_not`g']) (_se[z_not`g']) (e(N))


		*Analytical Sample
		reghdfe evictionorder z_not`g' if `g'==1 & analyticalsamp==1, absorb($fe) cluster($clusvar)
		frame post monotone ("benefits linked")  ("`g'") ("not`g'") (_b[z_not`g']) (_se[z_not`g']) (e(N))

		reghdfe evictionorder z_`g' if not`g'==1 & analyticalsamp==1, absorb($fe) cluster($clusvar)
		frame post monotone ("benefits linked") ("not`g'") ("`g'") (_b[z_`g']) (_se[z_`g']) (e(N))

		reghdfe evictionorder z_`g' if `g'==1 & analyticalsamp==1, absorb($fe) cluster($clusvar)
		frame post monotone ("benefits linked")  ("`g'") ("`g'") (_b[z_`g']) (_se[z_`g']) (e(N))

		reghdfe evictionorder z_not`g' if not`g'==1 & analyticalsamp==1, absorb($fe) cluster($clusvar)
		frame post monotone ("benefits linked") ("not`g'") ("not`g'") (_b[z_not`g']) (_se[z_not`g']) (e(N))
}

frame change monotone
replace courtsample = upper(courtsample )
replace estsample = upper(estsample)
replace instsample = upper( instsample)
save ${Inputs}/NY_monotonicity_estimates.dta, replace

